package service.impl;

import dao.ICarDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Car;
import service.ICarService;

import java.util.List;

@Service
public class CarServiceImpl implements ICarService {

    @Autowired
    private ICarDao carDao;

    public List<Car> getAllCars() {
        return carDao.getAllCars();
    }

    public Car getCarById(int id) {
        return carDao.getCarById(id);
    }

    public boolean updateCar(Car c) {
        return carDao.updateCar(c) > 0;
    }

    public boolean saveCar(Car c) {
        return carDao.saveCar(c) > 0;
    }

    public boolean deleteCar(int id) {
        return carDao.deleteCar(id) > 0;
    }
}
